]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
remote-search: don't use g_file_query_exists()
authorCosimo Cecchi <cosimoc@gnome.org>
Tue, 6 Nov 2012 22:32:39 +0000 (17:32 -0500)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 6 Nov 2012 22:47:48 +0000 (17:47 -0500)
This is called in the main thread, which we should never block for
synchronous I/O.
Since the operation we're wrapping is async already, just use
g_file_query_info_async() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=687491

js/ui/remoteSearch.js

index 0625475c8dc6b799d2fb13df9290f43b3de4e348..c4462e9f23186d66c68e95641e8150fbe2b23265 100644 (file)
@@ -38,9 +38,22 @@ function loadRemoteSearchProviders(addProviderCallback) {
     for (let i = 0; i < dataDirs.length; i++) {
         let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'search-providers']);
         let dir = Gio.file_new_for_path(path);
-        if (!dir.query_exists(null))
-            continue;
-        loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallback);
+
+        dir.query_info_async('standard:type', Gio.FileQueryInfoFlags.NONE,
+            GLib.PRIORITY_DEFAULT, null,
+                function(object, res) {
+                    let exists = false;
+                    try {
+                        object.query_info_finish(res);
+                        exists = true;
+                    } catch (e) {
+                    }
+
+                    if (!exists)
+                        return;
+
+                    loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallback);
+                });
     }
 };